package com.ks.core.framework.cpsupload.demos.pay;

import java.util.Map;

// 10. 使用示例
public class PaymentClient {
    public static void main(String[] args) {
        PaymentService paymentService = new PaymentService();
        
        // 微信支付
        UnifiedResponse payResponse = paymentService.executePayment(
            PaymentChannel.WECHAT,
            PaymentOperation.PAY,
            Map.of(
                "appId", "wx_app_123",
                "mchId", "mch_123",
                "amount", 100.00,
                "openId", "user_openid_abc"
            )
        );
        System.out.println("支付结果: " + payResponse);
        
        // 支付宝退款
        UnifiedResponse refundResponse = paymentService.executePayment(
            PaymentChannel.ALIPAY,
            PaymentOperation.REFUND,
            Map.of(
                "outTradeNo", "2024072210001",
                "refundAmount", 50.00
            )
        );
        System.out.println("退款结果: " + refundResponse);
        
        // 处理微信回调
        UnifiedResponse callbackResponse = paymentService.handleCallback(
            PaymentChannel.WECHAT,
            Map.of(
                "result_code", "SUCCESS",
                "transaction_id", "WX123456789",
                "time_end", "20240722103000"
            )
        );
        System.out.println("回调处理: " + callbackResponse);
    }
}